$(function() {
	$('.menu-bar')
		.each(function(){
			var b = $(this).find("button");
			$(this).bind('click', function(){
				if(b.hasClass("menu-close")){
					b.removeClass("menu-close");
					b.addClass("menu-open");
					$(this).next().hide();
				}else{
					b.removeClass("menu-open");
					b.addClass("menu-close");
					$(this).next().show();
				}
			});
		});
	selectedCurrent();	
});

function selectedCurrent(){
	var url = location.href,i,c,f,h;
	var a = $('#member-menu').find("a");
	url = url.substr(0, url.length - location.search.length);
	num = a.length;			
	 for(i = 0; i < num; ++i)
	 	if((c = a[i]) && ((f = c.parentNode).tagName === "LI" || (f = f.parentNode).tagName === "LI")) {
			h = c.href; 
			h = h.substr(0, h.length - c.search.length); 
			if(h === url) {
            	$(f).addClass("selected"); 
				return;
			}
        }
}